#!/bin/bash

absolute_dir=${PWD}/`dirname $0`
PKGDIR=./pkg
PYTHONHOME=/usr/local/python2.6
py_exec_path=~/bin

select_pgk() {
array=(`ls ${CWD}/${PKGDIR}`)

length=${#array[@]}

for ((i=0;i<$length;i++));
do
    echo "$i	${array[i]}"
done

echo -n "input your choice:"
read choice
echo "choice is $choice"
}

echo $absolute_dir

deal_sqlite-devel() {
    if [ `rpm -qa | grep sqlite-devel 2>/dev/null | wc -l` -ne 1 ];then
        echo -n "install sqlite-devel?(y/n)"
        read input

        if [ "$input" == "y" ];then
            rpm -ivh $PKGDIR/sqlite-devel-3.3.6-2.x86_64.rpm
        fi
    else
        echo "sqlite-devel installed."
    fi
}

install_python() {
    cd $PKGDIR
    tar -jxf Python-2.6.4.tar.bz2
    cd Python-2.6.4
    ./configure --prefix=$PYTHONHOME
    make
    make install

    ln -s $PYTHONHOME/bin/python2.6 $py_exec_path/python2.6
    
    cd -
    rm -rf Python-2.6.4
    cd $absolute_dir
}

deal_sqlite-devel
#install_python
